package doantotnghiep.business;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import doantotnghiep.dao.CustomerDao;
import doantotnghiep.model.Customer;

public class CustomerBusiness {

	@Autowired
	private CustomerDao customerDao;
	
	public Customer getCustomerById(int id) {
		Customer customer;
		customer = customerDao.findCustomerByID(id);
		System.out.println(customer.getFullName());
		return customer;
	}
	
	public List<Customer> listCustomer() {
		return customerDao.listCustomer();
	}
	
	public void addCustomer(Customer customer) {
	   customerDao.addCustomer(customer);		
	}
	public void saveCustomerChanged(Customer customer){
		customerDao.saveCustomer(customer);		
	}

	public void deleteCustomer(int id) {
        customerDao.deleteCustomer(id);		
	}

	public List<Customer> getCustomerByKey(String key) {
		return customerDao.getListcustomerByKey(key);
	}
}
